// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_REPR_WATER__
#define __H_MK_REPR_WATER__

#include "mk_entity.h"

namespace MK3DE
{
	class CScene;
	class CWater;
	class CHardwareBuffer;
	class CRenderInput;
	class CShader;
	class CTexture2D;

	class MK3DE_API CEntityWater : public CEntity
	{
	public:
		CEntityWater(CScene* pScene);
		~CEntityWater();

		//! Get entity render type and entity type.
		ENTITY_RENDER_TYPE GetRenderType() { return ERT_WATER; }
		ENTITY_TYPE GetType() { return ET_WATER; }

		BOOL Create(DWORD dwWidth, DWORD dwHeight, float fGridSize, const char* shaderFileName);
		BOOL CreateBumpTexture(const char* fileName);
		void UpdateLocalAABB();

		//! Set reflection texture.
		void SetReflectionTexture(CTexture2D* pTexture);

		//! Set refraction texture.
		void SetRefractionTexture(CTexture2D* pTexture);

		//! Render the water entity.
		void Render();

	private:
		CWater* _coreWater;

		CHardwareBuffer* _vbPosition;
		CHardwareBuffer* _ibIndex;

		CRenderInput* _renderInput;

		CShader* _shader;

		CTexture2D* _bumpTexture;
		CTexture2D* _reflectionTexture;
		CTexture2D* _refractionTexture;
	};
};

#endif // __H_MK_REPR_WATER__
